#include<linux/kernel.h>
#include<linux/init.h>
#include<linux/module.h>
#include <linux/fs.h>

dev_t dev = MKDEV(168, 0);

static int __init my_init(void)
{
  register_chrdev_region(dev, 1, "my_dev_1");
  pr_info("Major = %d Minor = %d \n",MAJOR(dev), MINOR(dev));
  pr_info("Kernel Module Inserted!\n");
  return 0;
}

static void __exit my_exit(void)
{
  unregister_chrdev_region(dev, 1);
  pr_info("Kernel Module Removed!\n");
}
 
module_init(my_init);
module_exit(my_exit);
 
MODULE_LICENSE("GPL");
MODULE_AUTHOR("feifei <feifei@gmail.com>");
MODULE_DESCRIPTION("A simple linux device driver");